<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body {
            height: 3000px;
        }

        div {
            display: none;
            width: 100px;
            height: 100px;
        }
    </style>
</head>

<body>
    <div>
        111
        111
        111
        1
        1111111
        111111

        11111111

        1
        1
        1
        1



        1111111111111
    </div>
    <script>
        const by = document.querySelector('body');
        const box = document.querySelector('div');
        console.log(box);

        window.addEventListener('scroll', function () {
            //获取html元素
            // console.log(document.documentElement)
            // console.log(document.documentElement.scrollTop);
            let num = document.documentElement.scrollTop = 1000;
            // const num = by.scrollTop;
            //     console.log(num);
            //     if (num >= 100) {
            //         box.style.display = 'block';
            //     } else {
            //         box.style.display = 'none';

            //     }

        })
    </script>
</body>

</html>